<?php
	class Test{
		
		private $id;
		private $intitule;
		private $duree;
		
		
		public function __construct(){
			if(func_num_args() == 1)
			$this->hydrate(func_get_arg(0));			
		}
		
		public function hydrate(array $donnees){
			foreach ($donnees as $key => $value){
				$method = 'set'.ucfirst($key);
				if (method_exists($this, $method)){
					$this->$method($value);
				}
			}
		}		
		
		// GETTERS
		public function id(){return $this->id;}
		public function intitule(){return $this->intitule;}
		public function duree(){return $this->duree;}
		
		//SETTERS
		public function setId($newId){$this->id = $newId;}
		public function setIntitule($newIntitule){$this->intitule = $newIntitule;}
		public function setDuree($newDuree){$this->duree = $newDuree;}
	}
?>